home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / libs / tsipp / tsipp.lha / tsipp3.0a / src / main.c next >
Encoding:
C/C++ Source or Header  |  1992-11-02  |  2.5 KB  |  80 lines

  1. /* 
  2.  * main.c --
  3.  *
  4.  * Modified version of TclX main.c that initializes the Tcl-SIPP commands.
  5.  *-----------------------------------------------------------------------------
  6.  * $Id: main.c,v 2.0 1992/11/02 03:56:13 markd Rel $
  7.  *-----------------------------------------------------------------------------
  8.  * Main to run the Tcl shell.  This file is a useful template for custom
  9.  * applications that wish to have Tcl as the top level command language.
  10.  *-----------------------------------------------------------------------------
  11.  * Copyright 1992 Karl Lehenbauer and Mark Diekhans.
  12.  *
  13.  * Permission to use, copy, modify, and distribute this software and its
  14.  * documentation for any purpose and without fee is hereby granted, provided
  15.  * that the above copyright notice appear in all copies.  Karl Lehenbauer and
  16.  * Mark Diekhans make no representations about the suitability of this
  17.  * software for any purpose.  It is provided "as is" without express or
  18.  * implied warranty.
  19.  */
  20.  
  21. #include "tSippInt.h"
  22.  
  23. int
  24. main (argc, argv)
  25.     int     argc;
  26.     char  **argv;
  27. {
  28.     Tcl_Interp *interp;
  29.  
  30.     /*
  31.      * If history is to be used, then set the eval procedure pointer that
  32.      * Tcl_CommandLoop so that history will be recorded.  This reference
  33.      * also brings in history from libtcl.a.
  34.      */
  35. #ifndef TCL_NOHISTORY
  36.      tclShellCmdEvalProc = Tcl_RecordAndEval;
  37. #endif
  38.  
  39.     /* 
  40.      * Create a Tcl interpreter for the session, with all extended commands
  41.      * initialized.  This can be replaced with Tcl_CreateInterp followed
  42.      * by a subset of the extended command initializaton procedures if 
  43.      * desired.
  44.      */
  45.     interp = Tcl_CreateExtendedInterp();
  46.  
  47.     /*
  48.      * Initialize SIPP and the Tcl-SIPP commands.
  49.      */
  50.     TSippInitialize (interp);
  51.  
  52.     /*
  53.      * Load the tcl startup code, this should pull in all of the tcl
  54.      * procs, paths, command line processing, autoloads, packages, etc.
  55.      * If Tcl was invoked interactively, Tcl_Startup will give it
  56.      * a command loop.
  57.      */
  58.  
  59.     Tcl_Startup (interp, argc, argv, NULL, 0);
  60.  
  61.     /* 
  62.      * Delete the interpreter (not neccessary under Unix, but we do
  63.      * it if TCL_MEM_DEBUG is set to better enable us to catch memory
  64.      * corruption problems)
  65.      */
  66.  
  67. #ifdef TCL_MEM_DEBUG
  68.     Tcl_DeleteInterp(interp);
  69. #endif
  70.  
  71. #ifdef TCL_SHELL_MEM_LEAK
  72.     printf (" >>> Dumping active memory list to mem.lst <<<\n");
  73.     if (Tcl_DumpActiveMemory ("mem.lst") != TCL_OK)
  74.         panic ("error accessing `mem.lst': %s", strerror (errno));
  75. #endif
  76.  
  77.     exit(0);
  78. }
  79.  
  80.